#include<bits/stdc++.h>
using namespace std;
int main() {
	int x, n;
	while (cin >> x >> n) {
		if (!x && !n)
			break;
		int a, b, c, y;
		a = ceil(pow(x, 1.0 / n));
		b = pow(a - 1, n);
		c = pow(a, n);
		y = abs(b - x) > abs(c - x) ? a : a - 1;
		cout << y << endl;
	}
	return 0;
}

